﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>搜索的多选</title>
    <script type="text/javascript" src="../../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../../../Scripts/config.js" type="text/javascript"></script>
    <script src="../../../Comm/Gener.js" type="text/javascript"></script>
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <base target="_self" />
    <script type="text/javascript">

        //页面启动函数.
        $(function () {

            //组织主键.
            var mypk = "MultipleChoiceSearch_" + GetQueryString("FK_MapData") + "_" + GetQueryString("KeyOfEn");

            var en = new Entity("BP.Sys.MapExt");
            en.MyPK = mypk;
            var i = en.RetrieveFromDBSources();

            GenerFullAllCtrlsVal(en);

            if (i == 0)
                $("#Btn_Delete").attr("disabled", true);
            else
                $("#Btn_Delete").removeAttr("disabled");

            //去掉 ' 号。
            var tag = en.Doc;
            while (tag.indexOf('~') > 1) {
                tag = tag.replace("~", "'");
            }

            //按照文本计算.
            $("#TB_Doc").val(tag);

        });

        //执行保存
        function Save() {

            //组织主键.
            var mypk = "MultipleChoiceSearch_" + GetQueryString("FK_MapData") + "_" + GetQueryString("KeyOfEn");
            var en = new Entity("BP.Sys.MapExt");
            en.MyPK = mypk;
            en.RetrieveFromDBSources();

            en.CopyForm(); //复制表单数据.

            en.FK_MapData = GetQueryString("FK_MapData");
            en.AttrOfOper = GetQueryString("KeyOfEn");
            en.ExtType = "MultipleChoiceSearch";
            en.MyPK = mypk;

            if (en.Update() == 0)
                en.Insert();

            window.location.href = "MultipleChoiceSearch.htm?FK_MapData=" + GetQueryString("FK_MapData") + "&KeyOfEn=" + GetQueryString("KeyOfEn") + "&M=" + Math.random();
            return;
        }

        //删除.
        function Delete() {

            if (window.confirm('您确定要删除吗？') == false)
                return;

            var mypk = "MultipleChoiceSearch_" + GetQueryString("FK_MapData") + "_" + GetQueryString("KeyOfEn");
            var en = new Entity("BP.Sys.MapExt");
            en.MyPK = mypk;
            en.RetrieveFromDBSources();
            var i = en.Delete();

            var url = "MultipleChoiceSearch.htm?FK_MapData=" + GetQueryString("FK_MapData") + "&KeyOfEn=" + GetQueryString("KeyOfEn") + "&M=" + Math.random();
            window.location.href = url;
        }
    </script>
</head>
<body>
    <form id="cc">
        <div style="right:10px; position:absolute; z-index:100; top:-3px">
            <input type="button" value="保存" id="Btn_Save" onclick="Save()" />
            <input type="button" value="删除" id="Btn_Delete" onclick="Delete()" />

        </div>

        <table style="width:100%;">
            <caption>文本框搜索多选 <a href="javascript:ShowHidden('help')"> <img src="../../../Img/Btn/Help.gif" /> 帮助:</a></caption>


            <tr>
                <td>

                    <a href="javascript:ShowHidden('SearchTip')">搜索提示</a>
                    <div id="SearchTip" style="color:Gray; display:none">
                        <ul>
                            <li>显示在搜索文本框的背景文字.</li>
                            <li>输入城市名称,比如:beijing,bj,进行搜索.</li>
                            <li>人员的编号,名称,拼音,进行模糊搜索.</li>
                        </ul>
                    </div>

                </td>
                <td><input type="text" id="TBPara_SearchTip" name="TBPara_SearchTip" style="width:90%;" /> </td>
            </tr>

            <tr>
                <td>数据源类型 </td>
                <td>

                    <select id="DDL_DBType" name="DDL_DBType">
                        <option value="0">执行SQL</option>
                        <option value="1">执行url返回JSON</option>
                        <option value="2">执行CCFromRef.js返回JSON</option>
                    </select>
                </td>
            </tr>



            <tr>
                <td colspan="2">数据源</td>
            </tr>

            <tr>
                <td colspan=2>
<textarea rows="3" id="TB_Doc" name="TB_Doc"></textarea>
                </td>
            </tr>
        </table>


       
        
        <div id="help" style="color:Gray; display:none">
            <ul>
                <li>SQL格式为:</li>
                <li>SELECT No,Name FROM Port_Emp WHERE PinYin LIKE '@Key%' OR No LIKE '%@Key%' OR Name LIKE '%@Key%' </li>
                <li>SELECT No,Name FROM CN_City WHERE PinYin LIKE '%@Key%' OR Name LIKE '%@Key%'</li>
                <li>URL格式为:</li>
                <li>/DataUser/Handler.ashx?xxx=sss </li>
                <li>方法的格式为:</li>
                <li>MyFunName</li>
            </ul>
        </div>

        <fieldset>
            <legend>运行效果</legend>
            <a href="javascript:WinOpen('MultipleChoiceSearch.png');"> <img src="MultipleChoiceSearch.png" /> </a>

        </fieldset>

    </form>

</body>
</html>
